<template>
    <el-menu-item index="9998-1" @click="handleLogout">退出登录</el-menu-item>
    <el-menu-item index="9998-2" @click="handleLogout">修改密码</el-menu-item>
</template>
<script setup>
import { userLogoutHttp } from "@/api/user";
import { useUserStore } from "@/stores/userStore";

import { useRouter } from "vue-router";

const router = useRouter();
//  获取路由参数

const { currentUser } = useUserStore();
const type = currentUser.type;
const handleLogout = () => {
  //  退出登录逻辑
  userLogoutHttp({ username: currentUser.username, type: type });
  router.push({ name: "login" });
};
</script>
